package cn.nexd.collector;


/**
 * Nexd 定位的配置类.
 * Created by codingfish on 15/9/28.
 */
public final class NexdCollectorConfiguration {

    //    public enum CollectionMode {
    //        COLLECTION_MODE_WIFI_ONLY(0), COLLECTION_MODE_BEACON_ONLY(1), COLLECTION_MODE_MIX(2);
    //
    //        private int collectionModeId;
    //
    //        CollectionMode(int collectionModeId) {
    //            this.collectionModeId = collectionModeId;
    //        }
    //
    //        public int getCollectionModeId() {
    //            return collectionModeId;
    //        }
    //    }

    public String appKey;
    public int wifiCollectorRate;
    public int bluetoothCollectorRate;
    public boolean wifiCollectorEnable;
    public boolean bluetoothCollectorEnable;
    public long beacon_collector_delay;
    public long wifi_collector_delay;

    public NexdCollectorConfiguration(Buidler buidler) {
        this.appKey = buidler.app_key;
        this.wifiCollectorRate = buidler.wifi_collector_rate;
        this.wifiCollectorEnable = buidler.wifi_collector_enable;
        this.bluetoothCollectorEnable = buidler.bluetooth_collector_enable;
        this.bluetoothCollectorRate = buidler.bluetooth_collector_rate;
        this.beacon_collector_delay = buidler.beacon_collector_delay;
        this.wifi_collector_delay = buidler.wifi_collector_delay;
    }


    public static class Buidler {
        private String app_key = "";//appKey

        private int wifi_collector_rate = 1000;//默认wifi采集器频率
        private int bluetooth_collector_rate = 1000;//默认蓝牙采集器频率

        private boolean wifi_collector_enable = true;//Wifi 是否采集
        private boolean bluetooth_collector_enable = false; // 蓝牙是否采集
        private long wifi_collector_delay = 100;
        private long beacon_collector_delay = 100;

        public NexdCollectorConfiguration build() {
            return new NexdCollectorConfiguration(this);
        }

        /**
         * 设置 AppKey
         *
         * @param app_key
         */
        public Buidler setAppkey(String app_key) {
            this.app_key = app_key;
            return this;
        }

        /**
         * 设置 wifi 采集的频率。
         *
         * @param wifi_collector_rate 频率（多少间隔采集一次），单位毫秒
         */
        public void setWifiCollectorRate(int wifi_collector_rate) {
            this.wifi_collector_rate = wifi_collector_rate;
        }

        /**
         * 设置 蓝牙 采集的频率。
         *
         * @param bluetooth_collector_rate 频率（多少间隔采集一次），单位毫秒
         */
        public void setBluetoothCollectorRate(int bluetooth_collector_rate) {
            this.bluetooth_collector_rate = bluetooth_collector_rate;
        }

        /**
         * 设置是否启动 Wifi 采集器。
         *
         * @param wifi_collector_enable
         */
        public void setWifiCollectorEnable(boolean wifi_collector_enable) {
            this.wifi_collector_enable = wifi_collector_enable;
        }

        /**
         * 设置是否启用蓝牙
         *
         * @param bluetooth_collector_enable
         */
        public void setBluetoothCollectorEnable(boolean bluetooth_collector_enable) {
            this.bluetooth_collector_enable = bluetooth_collector_enable;
        }

        /**
         * Beacon 采集前的延时
         *
         * @param beacon_collector_delay
         */
        public void setBeaconCollectorDelay(long beacon_collector_delay) {

            this.beacon_collector_delay = beacon_collector_delay;
        }

        /**
         * Wifi 采集前的延时
         *
         * @param wifi_collector_delay
         */
        public void setWifiCollectorDelay(long wifi_collector_delay) {

            this.wifi_collector_delay = wifi_collector_delay;
        }

        //        public void setCollectorMode(CollectionMode collectorMode) {
        //            this.collectionMode = collectorMode;
        //        }
    }
}
